{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>文章分类</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 文章分类</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title"></h3>
                    <div class="pull-left">
                        {:authAction(CONTROLLER_NAME.'/create', 'create')} 
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th>{$Think.lang.id}</th>
                            <th>{$Think.lang.typename}</th>
                            <th>{$Think.lang.mid}</th>
                            <th>{$Think.lang.dirs}</th>
                            <th>{$Think.lang.status}</th>
                            <th>{$Think.lang.sorts}</th>
                            <th width="258">{$Think.lang.action}</th>
                        </tr>
                        {volist name="dataList" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>
                                {if condition=" $vo.h_layer eq 1 "}
                                {else /}{for start="1" end="$vo.h_layer"}　　　{/for}├
                                {/if}
                                <span class="editable" data-pk="{$vo.id}" data-name="typename" data-url="{:url(CONTROLLER_NAME.'/edit', 'id='.$vo['id'])}" >{$vo.typename}</span>
                            </td>
                            <td>{$vo.ArctypeMod->name}</td>
                            <td><span class="editable" data-pk="{$vo.id}" data-name="dirs" data-url="{:url(CONTROLLER_NAME.'/edit', 'id='.$vo['id'])}" >{$vo.dirs}</span></td>
                            <td>
                                <a href="javascript:void(0);" data-id="{$vo.id}" data-field="status" 
                                data-value="{$vo.status}" data-url="{:url('edit', 'id='.$vo['id'])}" 
                                class='editimg fa {if condition=" $vo.status == 1 "}fa-check-circle text-green{else /}fa-times-circle text-red{/if}'></a>
                            </td>
                            <td>{$vo.sorts}</td>
                            <td>
                                <a class="btn btn-primary btn-xs" href="{$vo.typelink}" target="_blank"><i class="fa fa-eye"></i> {$Think.lang.preview}</a>
                                {if condition=" $vo.mid == 20 || $vo.mid == 22 "}
                                <button class="btn btn-default btn-xs disabled"><i class="fa fa-edit"></i> {$Think.lang.create_arc}</button>
                                {else /}
                                {:authAction('Archive/create', 'create_arc', ['typeid' => $vo.id])} 
                                {/if}
                                {include file="public/list_action" /}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    $('.editable').editable({
        emptytext: "empty",
        params: function(params) {      //参数
            var data = {};
            data['id'] = params.pk;
            data[params.name] = params.value;
            return data;
        },
        success: function(response, newValue) {
            var res = $.parseJSON( response );
            if(res.status == 1){
            }else{
                return res.info;
            }
        }
    });
    
    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}